//======================================================================
//======================================================================
//	API-CAP(W32)
//	CCAPDIO.H					CONTEC.CO.,LTD.
//======================================================================
//======================================================================


//======================================================================
// Error Code
//======================================================================
#define	DIO_ERR_SUCCESS					0		//Successed
#define	DIO_ERR_INI_MEMORY				3		//Cannot allocate memory
#define	DIO_ERR_INI_REGISTRY			4		//Cannot acceess setting file
#define	DIO_ERR_DLL_DEVICE_NAME			10000	//Used DeviceName unwritten in setting file
#define	DIO_ERR_DLL_INVALID_ID 			10001	//Invalid Id
#define	DIO_ERR_DLL_CREATE_FILE			10003	//Cannot open
#define	DIO_ERR_DLL_CLOSE_FILE			10004	//Close error
#define	DIO_ERR_ACCESS_RIGHT			10005	//Access rights error
#define	DIO_ERR_DLL_TIMEOUT				10006	//Timeout
#define	DIO_ERR_COMPOSITION				10007	//System error
#define	DIO_ERR_INFO_INVALID_DEVICE		10050	//Invalid device
#define	DIO_ERR_INFO_NOT_FIND_DEVICE	10051	//Not find device 
#define	DIO_ERR_DLL_BUFF_ADDRESS		10100	//Buffer address error
#define	DIO_ERR_SYS_NOT_SUPPORTED		20001	//Function is not supported
#define	DIO_ERR_SYS_PORT_NO				20100	//PortNo error
#define	DIO_ERR_SYS_PORT_NUM			20101	//PortNum error 
#define	DIO_ERR_SYS_BIT_NO				20102	//BitNo error
#define	DIO_ERR_SYS_BIT_NUM				20103	//BitNum error
#define	DIO_ERR_SYS_BIT_DATA			20104	//Bit data error
#define	DIO_ERR_SYS_DIRECTION			20106	//Direction error
#define	DIO_ERR_SYS_FILTER				20400	//Filter value error 

//======================================================================
// Function Prototype
//======================================================================
#ifdef __cplusplus
extern"C"{
#endif

long WINAPI	DioInit(char *Devicename, short *Id);
long WINAPI	DioExit(short Id);
long WINAPI	DioGetErrorString(long Err, char *szMsg);
long WINAPI	DioQueryDeviceName(short Index, short *GroupID, short *UnitID, short *DeviceID, char *DeviceName, char *Device);
long WINAPI	DioSetAccessRight(BYTE *AccsRight);
long WINAPI	DioSetDirectMode(short Id, short DirectMode);
long WINAPI	DioSetIOInterval(long Interval);
long WINAPI	DioGetRemoteStatus(short Id, BYTE *Start, BYTE *Status);
long WINAPI	DioSetDigitalFilter(short Id, short FilterValue);
long WINAPI	DioGetDigitalFilter(short Id, short *FilterValue);
long WINAPI	DioSetIoDirection(short Id, long Dir);
long WINAPI	DioGetIoDirection(short Id, long *Dir);
long WINAPI	DioInpByte(short Id, short PortNo, BYTE *Data);
long WINAPI	DioInpBit(short Id, short BitNo, BYTE *Data);
long WINAPI	DioOutByte(short Id, short PortNo, BYTE Data);
long WINAPI	DioOutBit(short Id, short BitNo, BYTE Data);
long WINAPI	DioEchoBackByte(short Id, short PortNo, BYTE *Data);
long WINAPI	DioEchoBackBit(short Id, short BitNo, BYTE *Data);
long WINAPI	DioInpMultiByte(short Id, short *PortNo, short PortNum, BYTE *Data);
long WINAPI	DioInpMultiBit(short Id, short *BitNo, short BitNum, BYTE *Data);
long WINAPI	DioOutMultiByte(short Id, short *PortNo, short PortNum, BYTE *Data);
long WINAPI	DioOutMultiBit(short Id, short *BitNo, short BitNum, BYTE *Data);
long WINAPI	DioEchoBackMultiByte(short Id, short *PortNo, short PortNum, BYTE *Data);
long WINAPI	DioEchoBackMultiBit(short Id, short *BitNo, short BitNum, BYTE *Data);
long WINAPI	DioGetMaxPorts(short Id, short *InPortNum, short *OutPortNum);
long WINAPI	DioGetMaxBits(short Id, short *InBitNum, short *OutBitNum);

#ifdef __cplusplus
}
#endif